#include "mainwidget.h"
#include "usermgmt.h"
#include "passworddbmgmt.h"
#include <QApplication>
#include <QMessageBox>
#include "databaseconnector.h"



int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    DatabaseConnector dbConn;

    dbConn.setDb_host("./database.db");
    dbConn.setDb_user("");
    dbConn.setDb_pass("");
    dbConn.setDb_type("QSQLITE");


    // DEBUG - create all windows
    MainWidget w;
    PasswordDBMgmt pwmgt;
    UserMgmt UsMgt;


    if (!dbConn.connectNow())
    {
        QMessageBox error;
        QString errorstring = QString("Connect failed for type " + dbConn.getDb_type() + "\r\n" + dbConn.lastError().text());
        error.setText(errorstring);
        error.exec();
        return 1;
    }else{

        w.show();
        pwmgt.show();
        UsMgt.show();
    }



    return a.exec();
}
